<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="__UI__/css/bs3/dpl.css" rel="stylesheet" type="text/css" />
<link href="__UI__/css/bs3/bui.css" rel="stylesheet" type="text/css" />
<link href="__UI__/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">

.button-tabs li {
	float:left;
	margin:0px 20px;
}

.control-group{
	margin:20px auto;
}

.control-group .controls{
	float:none;
	margin-bottom:40px;
}

.controls .button {
	margin-top:-22px;
	margin-right:20px;
}

.controls .con{
	width:85%;
	margin:20px auto 20px 130px;
	height:auto;
	line-height:30px;
	overflow:hidden;
	word-wrap: break-word; 
	word-break: normal;
	color:#fff;
}

.hint h4{
	margin:10px auto;
}

.hint ul{
	width:100%;
}

.hint ul li {
	display:inline-block;
	margin:0px 10px 10px 10px;
	height:40px;
	line-height:40px;
	color:#fff;
}

</style>
<script type="text/javascript" src="__UI__/js/jquery-1.8.1.min.js"></script>

</head>
<body>
<script language="javascript">

var winID = null;
function openFullWindow(url,winname){
	var strFeatures = "left=0,screenX=0,top=0,screenY=0";  
	if (window.screen){
		var maxh = screen.availHeight-30;
		var maxw = screen.availWidth-10;
		strFeatures += ",height="+maxh;
		strFeatures += "innerHeight"+maxh;
		strFeatures += ",width="+maxw;
		strFeatures += "innerwidth"+maxw;
	}else{
		strFeatures +=",resizable"; 
	}
	winID = window.open(url,winname,strFeatures);
}

</script>
<div class="demo-content" style="margin-top:1%;">
	<div class="row" style="width:90%; margin:0px auto;">
    	<div style="text-align:center"><h2>{$scripts.scriptsname} - 演练前奏</h2><hr></div>
        <div class="form-horizontal registerform">
            <a class="button button-primary" onClick="window.location.reload();" style="margin-bottom:10px;">刷新本页</a>
            <div class="hint">
            	<h4>操作提示</h4>
                <ul>
                	<li>1、点击综合演练窗口，开启演练计时</li>
                    <li>2、选择参演部门点击签到，进行部门签到</li>
                    <li>3、点击进入场景演练</li>
                </ul>
            </div>
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>演练窗口</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"title","tid"=>"演练名称"))}#scripts/drill','JS') style="margin-top:-2px;" />综合演练窗口</a>
                    </div>
				</div>
            </div>
            
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>演练名称</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"scriptsname","tid"=>"演练名称"))}#scripts/drill','JS')>主屏显示</a>
                        <audio controls src='{:U("Home/Scripts/voice",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"scriptsname","tid"=>"演练名称"))}'></audio>
                    </div>
                    <div class="controls">
                        <div class="con"><pre>{$scripts.scriptsname}</pre></div>
                    </div>
				</div>
            </div>
            
            <if condition="$scripts.range neq ''">
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>演练范围</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"range","tid"=>"演练范围"))}#scripts/drill','JS')>主屏显示</a>
                        <audio controls src='{:U("Home/Scripts/voice",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"range","tid"=>"演练范围"))}'></audio>
                        <div class="con"><pre>{$scripts.range}</pre></div>
                    </div>
				</div>
            </div>
            </if>
            
            <if condition="$scripts.brief neq ''">
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>灾害介绍</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"brief","tid"=>"灾害介绍"))}#scripts/drill','JS')>主屏显示</a>
                        <audio controls src='{:U("Home/Scripts/voice",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"brief","tid"=>"灾害介绍"))}'></audio>
                        <div class="con"><pre>{$scripts.brief}</pre></div>
                    </div>
				</div>
            </div>
            </if>
            
            <if condition="$scripts.pic neq ''">
            <div class="control-group">
            	<div class="controls">
					<label class="control-label"><h3>多媒体文件</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"pic","tid"=>"多媒体文件"))}#scripts/drill','JS') style="margin-top:-2px">主屏显示</a>
                    </div>
				</div>
            </div>
            </if>
            
			<if condition="$scripts.goal neq ''">
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>演练目标</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"goal","tid"=>"演练目标"))}#scripts/drill','JS')>主屏显示</a>
                        <audio controls src='{:U("Home/Scripts/voice",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"goal","tid"=>"演练目标"))}'></audio>
                        <div class="con"><pre>{$scripts.goal}</pre></div>
                    </div>
				</div>
            </div>
            </if>
            
			<if condition="$scripts.rules neq ''">
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>演练规则</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"rules","tid"=>"演练规则"))}#scripts/drill','JS')>主屏显示</a>
                        <audio controls src='{:U("Home/Scripts/voice",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"rules","tid"=>"演练规则"))}'></audio>
                        <div class="con"><pre>{$scripts.rules}</pre></div>
                    </div>
				</div>
            </div>
            </if>
         
			<if condition="$scripts.department neq ''">
            <div class="control-group">
				<div class="controls">
                    <label class="control-label"><h3>参演部门</h3></label>
                    <div class="controls">
                        <a class="button button-primary" onclick=openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"department","tid"=>"参演部门"))}#scripts/drill','JS') style="margin-top:-2px;">主屏显示</a>
                        <a class="button button-warning" onclick="signFunction();" style="margin-top:-2px;">全选</a>
                        <a class="button button-warning" onclick="submitFunction();" style="margin-top:-2px;">签到</a>
                        <div id="show6" class="con">
                            <volist name="department" id="v" key="k">
                            	<div style="display:inline-block; width:200px">
                                	<label><input id="send_{$k}" type="checkbox" name="department[{$k}]" class="staff" value="{$v}">&nbsp;{$v}</label>

                              </div>
                            </volist>

                        </div>
                    </div>
				</div>
            </div>
            </if>
            <div class="row actions-bar">
				<div class="form-actions span13">
					<a class="button button-primary" id="scenario">场景演练</a>
                    <a class="button button-primary" id="results">结束演练</a>
				</div>
			</div>
        </div>
        <a class="button button-primary" onClick="window.location.reload();" style="margin-bottom:10px;">刷新本页</a>
	</div>
</div>
<script type="text/javascript" src="__UI__/js/config.js"></script>
<script type="text/javascript" src="__UI__/js/bui.js"></script>
<script type="text/javascript" src="__UI__/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">

	function signFunction(){
		var arr = $(':checkbox'); 
		for(var i=0;i<arr.length;i++){ 
			arr[i].checked = ! arr[i].checked; 
		}	
	}
		
	function checkFunction(){
		
		var chenked=$("input[type='checkbox']:checked").val([]); 
		var names = "";
		if(chenked){
			for(var i=0;i<chenked.length;i++){ 
				names += chenked[i].value +","; 
			}
			
			return names
		}

	}
	
	function submitFunction(){
		var val = checkFunction();
		var id = {$record.id};
		$.ajax({
			type:'post',
			url:'{:U("Home/Record/edit")}',
			dataType:'json',
			data:{id:id, department:val},
			success:function(data){
				if(data.status == 'y'){
					openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"department","tid"=>"参演部门","k"=>1))}#scripts/drill','JS');
				}else{
					openFullWindow('{:U("Home/Drill/index",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"bid"=>"scripts","nid"=>"department","tid"=>"参演部门","k"=>1))}#scripts/drill','JS');
				}
			}
		});
	}
	
	$(function () {       
		$('#scenario').click(function(){
			top.topManager.openPage({
				id:'scenario',
				title:'演练场景',
				href:'{:U("Scripts/scenario",array("sid"=>I("get.sid"),"pid"=>I("get.pid"),"did"=>1))}',
				isClose:true,
				reload:true,
			});
		 });
    });
	
	$(function () {       
		$('#results').click(function(){
			top.topManager.openPage({
				id:'result',
				title:'演练总结',
				href:'{:U("Scripts/result",array("sid"=>I("get.sid"),"pid"=>I("get.pid")))}',
				isClose:true,
				reload:true,
			});
		 });
    });
	
</script>
</body>
</html>